﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="FileUploads.aspx.cs" Inherits="WMS6.Web.TransportManagement.FileUploads" meta:resourcekey="Page" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Upload</title>
    <link href="../style/zh/1/css.css" type="text/css" rel="Stylesheet" id="mycss" />
    <link href="../Css/style.css" type="text/css" rel="stylesheet" />
    
    <script src="../Js/jquery.js" type="text/javascript"></script>
    <script src="../Js/jquery.simplemodal.js" type="text/javascript"></script>
    <script src="../Js/util.js" id="js" type="text/javascript"></script>
    <script src="../Js/InitPage.js" type="text/javascript"></script>    
    
    <base target="_self" />   
    <script src="../Js/calendar.js" type="text/javascript" charset="gb2312"></script>
    <script language="javascript">
    
            //初始化页面
            window.onload = function(){
            var actionID = window.dialogArguments;
            if(actionID != "" && actionID != null)
            {
                var array = actionID.split(',');
                initQueryPage(array[0],array[1]);
            }
            else
            {
                initDetailPage();
            }
        }

    
         var fileCount =1;
        function AddFileUpload(){
            if(document.getElementById("File6").style.display=="block"){
                alert('最多只能上传6个文件!');
                return;
            }
             fileCount += 1;
             document.getElementById("File"+fileCount).style.display="block";
         }

         function ShowProcess() {
             document.getElementById("Process").style.display = "block";
         }
         function checkFileExt() {
         var fileName ;
             for (j = 1; j <= 6; j++) {
                 fileName = document.getElementById("File" + j).value;
                 $("#File" + j).css("border-width", "");
                 $("#File" + j).css("border-color", "");
                 if (fileName != "") {
                     var fileExt = fileName.substring(fileName.lastIndexOf("."), fileName.length).toLowerCase();
                     if (fileExt != ".gif" && fileExt != ".png" && fileExt != ".jpeg" && fileExt != ".jpg" && fileExt != ".pdf" && fileExt != ".tif") {
                         $("#File" + j).css("border-width", "1px");
                         $("#File" + j).css("border-color", "red");
                         $("#Process").css("display", "none");
                         alert('请查证上传文件的格式');
                         return false;
                     }
                 }
            }
            return true;
            
         }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id="div_top">
        <table id="Table1" runat="server">
            <tr>
                <td align="center">
                    <asp:Button ID="btUpFiles" runat="server" Text="保存" OnClick="btUpFiles_Click" OnClientClick="ShowProcess()"
                         CssClass="button" meta:resourcekey="btUpFiles" />
                </td>
                <td>
                    <asp:Label ID="lblOverrideLocation" runat="server" Text="单个文件必须小于4MB"
                        CssClass="label" meta:resourcekey="lblOverrideLocation"></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    
    <div>
        <asp:Label ID="lblMsg" runat="server" CssClass="label_message" 
            meta:resourcekey="lblMsg"></asp:Label>
     </div>
    
    <div id="div_query">
        <table id="tbFiles" width="580px" cellpadding="0" border="0px" cellspacing="0">
            <tr>
                <td style="height: 30px; ">
                    <asp:FileUpload ID="File1" runat="server" meta:resourcekey="File1" />
                    <div style=" height:10px;"></div>
                    <input id='File2' type='file' style="display: none;margin-bottom:10px;" runat="server"/>
                    <input id='File3' type='file' style="display: none;margin-bottom:10px;" runat="server" />
                    <input id='File4' type='file' style="display: none;margin-bottom:10px;" runat="server" />
                    <input id='File5' type='file' style="display: none;margin-bottom:10px;" runat="server" />
                    <input id='File6' type='file' style="display: none;margin-bottom:10px;" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    <div id='Process' style="color: BlueViolet; display: none;">
                        Uploading...<img src='../Images/ajax-loader.gif' align='absmiddle' /></div>
                </td>
            </tr>
        </table>
    </div>
    <div id="div_bottom">
        <table id="btnTable"  cellpadding="0" border="0px" cellspacing="0" >
            <tr>
                <td align="center">
                          <input type="button" class="button" value="增加"  id="btnAdd" runat="server" onclick="AddFileUpload();" />
                </td>
            </tr>
        </table>
    </div>
    <input id="filepath" type="hidden" runat="server" />
    <input id="originalpath" type="hidden" runat="server" />
    <input id="thumbnailpath" type="hidden" runat="server" />
    <input id="width" type="hidden" runat="server" />
    <input id="height" type="hidden" runat="server" />
    <input id="hdnRtnValue" type="hidden" runat="server" />
    </form>
</body>
</html>

<script language="javascript" type="text/javascript">
   window.returnValue = document.getElementById("hdnRtnValue").value;
   if(window.returnValue != "")
   {
        window.close();
   }
</script>
